﻿using Ue.Qcdz.Domain.SaleCategorys;

namespace Ue.Qcdz.Repositories.SaleCategorys
{
    public class SaleCategryDataQueryWhereClause : Ue.Infrastructure.RepositoryFramework.Repository.IWhereClause
    {
        private ISaleCategoryDataQuery saleCategoryDataQuery;

        public SaleCategryDataQueryWhereClause(ISaleCategoryDataQuery dataQuery)
        {
            this.saleCategoryDataQuery = dataQuery;
        }

        #region IWhereClause 成员

        public string Clause
        {
            get
            {
                string whereClause = "1=1";
                if (this.saleCategoryDataQuery.Status)
                    whereClause += string.Format(" and {0} = 1", SaleCategryFactory.FieldNames.Status);
                if (!string.IsNullOrEmpty(this.saleCategoryDataQuery.ShopId))
                    whereClause += string.Format(" and {0} = '{1}'", SaleCategryFactory.FieldNames.ShopId, this.saleCategoryDataQuery.ShopId);
                return whereClause;

            }
        }

        public System.Data.IDataParameter[] Parameters
        {
            get { return null; }
        }

        #endregion
    }
}
